<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>TbdAutoEmail</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" type="text/css" href="css/tbdautoemail.css">
</head>
<body>
  <h3 style="width:1000px;margin:20px auto;">
    基于原生js<br/>

邮箱自动补全提示插件（兼容所有主流浏览器，ie7及ie7以上）<br/>

1.输入内容后弹出提示列表<br/>
2.为空不弹出<br/>
3.页面滚动，窗口改变位置重定位<br/>
4.输入内容符合邮箱弹出<br/>
5.邮箱正则匹配回调<br/>
6.键盘上下键选取<br/>
7.全局键盘选值回调，返回当前操作输入框id<br/>
  </h3>
  <div class="box">
      <h4>
        
      </h4>
      <h3>基本自动补全</h3>
      <p> 
        <input type="text" class="form-control" id="input_ed_email1" placeholder="输入正确邮箱" />
      </p>  
      <h3>调用回调，自动补全</h3>
      <p> 
        <input type="text" class="form-control" id="input_ed_email2" placeholder="输入正确邮箱" />
        <br/>
        <div id="ti" style="color: red;"></div>
      </p>   
      <h3>利用键盘选取赋值成功，调用的额外回调，会返回操作输入框id，自动补全</h3>
      <p> 
        <input type="text" class="form-control" id="input_ed_email3" placeholder="输入正确邮箱" />
        <br/>
        <div id="ti" style="color: red;"></div>
      </p>   
  </div>
</body>
</html>
<script type="text/javascript" src="js/tbdautoemail.js"></script>
<script type="text/javascript">

    //邮箱补全
    new TbdAutoEmail({
      inputid:"input_ed_email1", 
      selectsuccess:function(){ 
        
      },
      regpass:function(){
        
      },
      regerr:function(){
        
      }
    }).init();  

 
    new TbdAutoEmail({
      inputid:"input_ed_email2",
      selectsuccess:function(){
        document.getElementById('ti').innerHTML="选择下拉内容成功";
      },
      regpass:function(){
        document.getElementById('ti').innerHTML="邮箱格式正确";
      },
      regerr:function(){
        document.getElementById('ti').innerHTML="邮箱格式错误";
      }
    }).init();  


    TbdAutoEmail.keydownevent=function(showid){
      if(showid=="input_ed_email3"){
        alert("输入框id"+showid+"我是正在键盘设置值的输入框")
      };   
    };
    new TbdAutoEmail({
      inputid:"input_ed_email3",
      selectsuccess:function(){

      },
      regpass:function(){
  
      },
      regerr:function(){
        
      }
    }).init();  

  
    //end
</script>
